package com.example.io.fileinputstream;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @Author 尚智江
 * @description
 * @CreateDate 2024/1/9 21:57
 */
public class ByteStreamByIn4 {
    public static void main(String[] args) throws IOException {
        /*
        大文件拷贝   使用数组修改
         */

        // 程序开始时间
        long l = System.currentTimeMillis();

        FileInputStream fileInputStream = new FileInputStream("C:\\Users\\28593\\Desktop\\上合文件\\Java面试就业冲刺宝典.pdf");
        FileOutputStream outputStream = new FileOutputStream("E:\\SpringBoot\\Spring-Boot\\java-io\\src\\main\\resources\\a.pdf");

        int len;
        byte[] bytes = new byte[1024 * 1024 * 10];
        while ((len = fileInputStream.read(bytes)) != -1) {
            outputStream.write(bytes, 0, len);
        }

        outputStream.close();
        fileInputStream.close();

        // 程序结束时间
        long l1 = System.currentTimeMillis();
        // 程序运行时间
        System.out.println(l1 - l);
    }
}
